import 'package:ichinesereader/models/common/LevelProgress.dart';
import 'package:ichinesereader/models/common/Settings.dart';
import 'dart:convert';

ProfileResult profileResultFromJson(String str) =>
    ProfileResult.fromJson(json.decode(str));

String profileResultToJson(ProfileResult data) => json.encode(data.toJson());

class ProfileResult {
  bool? deleted;
  bool? disabled;
  String? email;
  String? firstName;
  String? lastLogIn;
  int? lastLoggedIn;
  String? lastName;
  String? nickName;
  String? accessCode;
  dynamic dateOfBirth;
  String? profileImageUrl;
  List<String>? role;
  Settings? settings;
  LevelProgress? levelProgress;
  int? timestampCreated;
  int? timestampDisabled;
  int? timestampEnabled;
  int? timestampPasswordChanged;
  String? userId;
  String? userName;
  int? numBooks;
  String? level;
  int? levelPercentage;
  String? gender;
  int? points;
  int? theme;
  int? lang;

  ProfileResult({
    this.deleted,
    this.disabled,
    this.email,
    this.firstName,
    this.accessCode,
    this.lastLogIn,
    this.lastLoggedIn,
    this.lastName,
    this.nickName,
    this.dateOfBirth,
    this.profileImageUrl,
    this.role,
    this.settings,
    this.levelProgress,
    this.timestampCreated,
    this.timestampDisabled,
    this.timestampEnabled,
    this.timestampPasswordChanged,
    this.userId,
    this.userName,
    this.numBooks,
    this.gender,
    this.level,
    this.levelPercentage,
    this.points,
    this.lang,
    this.theme,
  });

  ProfileResult.fromJson(Map<String, dynamic> json) {
    deleted = json['deleted'];
    disabled = json['disabled'];
    email = json['email'];
    firstName = json['firstName'];
    nickName = json['nickName'];
    accessCode = json['accessCode'];
    lastLogIn = json['lastLogIn'];
    lastLoggedIn = json['lastLoggedIn'];
    lastName = json['lastName'];
    profileImageUrl = json['profileImageUrl'];
    role = json['role'].cast<String>();
    settings = json['settings'] != null
        ? new Settings.fromJson(json['settings'])
        : null;
    levelProgress = json["levelProgress"] != null
        ? LevelProgress.fromJson(json["levelProgress"])
        : null;
    timestampCreated = json['timestampCreated'];
    timestampDisabled = json['timestampDisabled'];
    timestampEnabled = json['timestampEnabled'];
    timestampPasswordChanged = json['timestampPasswordChanged'];
    userId = json['userId'];
    dateOfBirth = json['dateOfBirth'];
    userName = json['userName'];
    numBooks = json["numBooks"];
    level = json["level"];
    levelPercentage = json["levelPercentage"];
    gender = json["gender"];
    points = json['points'];
    theme = json['theme'];
    lang = json['lang'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['deleted'] = this.deleted;
    data['disabled'] = this.disabled;
    data['email'] = this.email;
    data['accessCode'] = this.accessCode;
    data['firstName'] = this.firstName;
    data['nickName'] = this.nickName;
    data['dateOfBirth'] = this.dateOfBirth;
    data['lastLogIn'] = this.lastLogIn;
    data['lastLoggedIn'] = this.lastLoggedIn;
    data['lastName'] = this.lastName;
    data['profileImageUrl'] = this.profileImageUrl;
    data['role'] = this.role;
    if (this.settings != null) {
      data['settings'] = this.settings!.toJson();
    }
    data['levelProgress'] =
        levelProgress != null ? levelProgress?.toJson() : null;
    data['timestampCreated'] = this.timestampCreated;
    data['timestampDisabled'] = this.timestampDisabled;
    data['timestampEnabled'] = this.timestampEnabled;
    data['timestampPasswordChanged'] = this.timestampPasswordChanged;
    data['userId'] = this.userId;
    data['userName'] = this.userName;
    data['points'] = this.points;
    data['gender'] = this.gender;
    data['numBooks'] = this.numBooks;
    data['level'] = this.level;
    data['levelPercentage'] = this.levelPercentage;
    data['theme'] = this.theme;
    data['locale'] = this.lang;
    return data;
  }
}
